<%@page import="model.UsersModel"%>
<%@page import="dao.UsersDao"%>
<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
    <meta http-equiv="pragma" content="no-cache">
<%
	//1:设置中文编码
request.setCharacterEncoding("utf-8");
//2:获取数据（用户名，密码）
String username = request.getParameter("username");
String userpass = request.getParameter("userpass");
//3:传递用户名和密码给dao
UsersDao dao =new UsersDao();
UsersModel model = dao.login(username, userpass);
if(model!= null){
	//登录成功，记录用户登录状态
	session.setAttribute("username",model.getUsername());
	session.setAttribute("usertel",model.getUsertel());
	session.setAttribute("id",model.getId());
	session.setAttribute("headerimage",model.getHeaderimage());
	response.sendRedirect("ucenter.jsp?login=1");
}else{
	response.sendRedirect("login.jsp?login=0");
}
%>
